!{include file='common/iheader.htm'}
<style>
	.list_view strong{width:65%}
	.list_view span{color:#999;}
	.opt_div{width:34%}
	.form_btn_item{margin-top:20px;}
</style>
<div id="i_nav">
	<h3 class="page_title">自定义属性组</h3>
	<a class="button" href="/manager.php?app=attrs&act=edit">添加属性组</a>
	<a class="button" href="/manager.php?app=relation">关联属性管理</a>
	<a class="button" href="/manager.php?app=forms">表单管理</a>
</div>
<ul class="list_view">
	!{foreach from=$attrs item=attr_cate key=id}
	<li id="attrs_!{$id}">
		<strong>
			<a href="/manager.php?app=attrs&act=edit&id=!{$id}" title="!{$attr_cate.desc}">!{$attr_cate.name}</a>
			!{if $attr_cate.desc}
			<span class="ui-icon ui-icon-info" title="!{$attr_cate.desc}"></span>
			!{/if}
		</strong>
		<div class="opt_div">
			<a href="javascript:void(0)" onclick="copy_attrs('!{$id}')"><span class="ui-icon ui-icon-copy"></span>复制</a>
			<a href="/manager.php?app=attrs&act=edit&id=!{$id}"><span class="ui-icon ui-icon-pencil"></span>修改</a>
			<a href="javascript:void(0)" onclick="del_attrs('!{$id}')"><span class="ui-icon ui-icon-trash"></span>删除</a>
		</div>
	</li>
	!{foreachelse}
	<li>
		<strong>暂无记录...</strong>
	</li>
	!{/foreach}
</ul>
<form method="post" action="/manager.php?app=attrs&act=copy_attrs" id="copy_attrs" title="复制属性组" class="dialog">
	<div class="form_item">
		<strong>分类名称：</strong>
		<div><input class="text_input" maxlength="50" type="text" name="name" value=""/></div>
		<p>(名称长度在1至50之间)</p>
	</div>	
	<div class="form_item">
		<strong>分类描述：</strong>
		<div><input class="text_input" maxlength="50" type="text" name="desc" value=""/></div>
	</div>
	<div class="form_item form_btn_item">
		<input class="button main" type="button" value="保存" />
		<input type="hidden" name="id" value="" />
	</div>
</form>
<script type="text/javascript">
	function copy_attrs(id){
		$("#copy_attrs").dialog({width:480,modal:true, open:function(){
			$("#copy_attrs input[name='id']").val(id);
			$('#copy_attrs').ajax_form({
				submit_btn : '.main'
			});
		}});
	}

	function del_attrs(id){
		if(confirm('删除后，将可能影响使用，是否继续删除？')){
			var url = '/manager.php?app=attrs&act=attr_del&id=' + id;
			$.get(url, function(data){
				var json = eval('(' + data + ')');
				alert(json.info);
				if(json.result){
					$("#attrs_" + id).remove();
				}
			});
		}
	}
</script>
!{include file='common/ifooter.htm'}